package com.avicsafety.ezsystem.mvp.presenter;

import com.avicsafety.ezsystem.mvp.model.MvpTestModel;
import com.avicsafety.ezsystem.mvp.view.MvpTestView;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import io.reactivex.Scheduler;
import io.reactivex.android.BuildConfig;
import io.reactivex.android.plugins.RxAndroidPlugins;
import io.reactivex.functions.Function;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;

import static org.mockito.Mockito.times;

public class MvpTestPresenterCC extends BasePresenter<MvpTestView> {

    @Mock
    private MvpTestView mvpView;

    @Rule
    public MockitoRule mockitoRule = MockitoJUnit.rule();


    @Test
    public void getData(){

        MvpTestPresenter presenter = new MvpTestPresenter();

        presenter.getData("success");

        try {
            Thread.sleep(60000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

    private void initRxJava() {
        RxJavaPlugins.reset();
        RxJavaPlugins.setIoSchedulerHandler(new Function<Scheduler, Scheduler>() {
            @Override
            public Scheduler apply(Scheduler scheduler) throws Exception {
                return Schedulers.trampoline();
            }
        });
        RxAndroidPlugins.reset();
        RxAndroidPlugins.setMainThreadSchedulerHandler(new Function<Scheduler, Scheduler>() {
            @Override
            public Scheduler apply(Scheduler scheduler) throws Exception {
                return Schedulers.trampoline();
            }
        });
    }


    private Object mLock = new Object(); // 同步锁
    private int mCount = 0; // 加解锁条件




}
